#!/usr/bin/php
<?php
ini_set( 'memory_limit', '1024M' );
$file = "../dat/summary0.dat";
$fp = fopen( $file, "rb" );
$buf = fread( $fp, 1024*8 );
$headers = unpack( 'i*', $buf );
for( $i = 0; $i < 1024; $i++ ) {
    if( $headers[$i*2] != 0 ) {
        printf("=============================================\n");
        $location = $headers[$i*2] + 500;
        $len = $headers[$i*2 + 1];
        printf("offset = %d, len = %d\n", $headers[$i*2], $headers[$i*2 + 1] );
        printf("offset = %d, len = %d\n", $location, $len );
        fseek( $fp, SEEK_SET, $location );
        $buf = fread( $fp, $len );
        $content = unpack('a*', $buf);
        print_r( $content );
        #printf("text = %s\n", $content[1] );
    }
}
#print_r( $headers );
fclose( $fp );
?>
